Page({
  data: {
    tasks: [
      // ... 现有任务数据
    ],
    todayPoints: 25,
    totalPoints: 1280,
    continuousDays: 5
  },

  completeTask(taskId) {
    const task = this.data.tasks.find(t => t.id === taskId);
    if (task && task.status !== 'completed') {
      // 更新任务状态
      task.status = 'completed';
      // 增加积分
      const newPoints = this.data.totalPoints + task.points;
      
      this.setData({
        tasks: this.data.tasks,
        totalPoints: newPoints,
        todayPoints: this.data.todayPoints + task.points
      });

      // 检查是否所有任务都完成
      this.checkAllTasksCompleted();
    }
  },

  checkAllTasksCompleted() {
    const allCompleted = this.data.tasks.every(t => t.status === 'completed');
    if (allCompleted) {
      // 额外奖励
      wx.showModal({
        title: '恭喜',
        content: '完成所有每日任务，获得额外50积分！',
        showCancel: false
      });
      this.setData({
        totalPoints: this.data.totalPoints + 50,
        todayPoints: this.data.todayPoints + 50
      });
    }
  },

  // ... 其他现有方法
}); 